<extend name="Base/common"/>
<block name="Content">
    <div class="am-cf am-padding-top">
        <div class="am-fl am-cf">
           <notempty name="menuModel">
                <i class="am-icon-pencil-square-o"></i>
                <else/><i class="am-icon-plus-square"></i>
            </notempty>
            <strong class="am-text-primary am-text-lg">
                <notempty name="menuModel">
                    编辑<else/>新增
                </notempty>菜单
            </strong>
        </div><hr data-am-widget="divider" class="am-divider am-divider-default" />
    </div>
    <div class="am-tabs" data-am-tabs>
        <ul class="am-tabs-nav am-nav am-nav-tabs">
            <li>
                <a href="#tab2">
                    <notempty name="menuModel">
                        编辑<else/>新增
                    </notempty>菜单
                </a>
            </li>
        </ul>
        <div class="am-tabs-bd">
            <div class="am-tab-panel am-fade" id="tab2">
                <form class="am-form" method="post" action="{:U('Menu/addMenu')}">
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            序号
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <input type="number" class="am-input-sm" name="sort_no" value="{$menuModel['sort_no']|default='1'}" max="100" min="1" step="1"/>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            菜单名称
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="menu_name" value="{$menuModel['menu_name']}" required/>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                            *必填，不可重复
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            所属上级
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <select data-am-selected="{btnSize: 'sm', btnStyle: 'secondary',maxHeight: 200}" name="parent_id" id="parent_id">
                                <option value="0">无</option>
                                <foreach name="menu_tree" item="vo">
                                    <option value="{$vo.menu_id}">|─({$vo.sort_no})-{$vo.menu_name}</option>
                                    <notempty name="vo['_child']">
                                        <foreach name="vo['_child']" item="sub_mane">
                                            <option value="{$sub_mane.menu_id}">|　|─({$sub_mane.sort_no})-{$sub_mane.menu_name}</option>
                                        </foreach>
                                    </notempty>
                                </foreach>
                            </select>
							<input type="hidden" name="parent" value="{$menuModel['parent_id']}"/>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            菜单地址
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="menu_url" value="{$menuModel['menu_url']}" required/>
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                            *必填,输入Menu/index这样的形式
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            图标
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="menu_icon" value="{$menuModel['menu_icon']}" />
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            扩展样式
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="menu_style" value="{$menuModel['menu_style']}" />
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
					  <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            是否显示
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                        	 <label class="am-radio-inline am-secondary">
                                    <input type="radio" name="show_status" value="0" data-am-ucheck/>否
                                </label>
                                <label class="am-radio-inline am-secondary">
                                    <input type="radio" name="show_status" value="1" data-am-ucheck>是 
                                </label>
                             
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">
                        </div>
                    </div>
                    <div class="am-margin">
                        <button type="submit" class="am-btn am-btn-success am-btn-xs am-btn-xs ajax-post" target-form="am-form">
                            提交保存
                        </button>
                        <button type="button" class="am-btn am-btn-secondary am-btn-xs" onclick="javascript:history.back(-1);return false;">
                            返回列表
                        </button>
                        <input type="hidden" value="{$menuModel['menu_id']}" name="menu_id"/>
                    </div>
                </form>
            </div>
        </div>
    </div>
</block>
<block name="script">
    <script type="text/javascript">
    	   Think.setValue('parent_id',{$menuModel.parent_id|default=1});
       Think.setValue('show_status',{$menuModel.show_status|default=1});
    </script>
</block>
